import fetch from '@/utils/fetch';
const prefix = '/userService/lcdpLogin';

/** 获取验证码 */
export const getCodeInfo = (sessionId: string) =>
  fetch<API.Login.CodeResult>({
    method: 'get',
    url: `${prefix}/code`,
    params: { sessionId },
    name: '获取验证码',
  });

/** 用户登录 */
export const login = (params: API.Login.LoginParams) =>
  fetch<API.Login.LoginResult>({
    method: 'post',
    url: `${prefix}/login`,
    params,
    name: '用户登录',
  });

/** 登陆后选择进入租户 */
export const selectTenant = (tenantId: string) =>
  fetch<API.Login.UserInfo>({
    method: 'get',
    url: `${prefix}/info`,
    params: { tenantId },
    name: '登陆后选择进入租户',
  });
